<?php
class UserApplications extends Zend_Db_Table_Abstract
{
    protected $_name = 'user_applications';
	protected $_primary = array( 'user_id', 'application_id');
	private $_apps;
	public function getApplicationsFromUser( $userId ) 
	{
		
		if( $userId == false ) {
			return false;
		}
		$this->_apps = $this->fetchAll(
			$this->select()
				->where( 'user_id = ?', $userId  )
		);
		return $this->_apps;
	}
	public function getApplicationsFromUserinArray( $userId )
	{
		$apps = $this->getApplicationsFromUser( $userId );
		if( $apps == null ) {
			return array();
		}
		$appsInArray = array();
		foreach( $apps as $app ) {
			$appsInArray[] = $app->application_id;	
		}
		return $appsInArray;
	}
}